package com.tanhua.server.controller;

import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.server.service.HuanXinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/huanxin")
public class HuanXinController {


    @Autowired
    private HuanXinService huanXinService;


    /**
     * 用户在注册探花交友项目的账号时，同时我们的服务端为用户注册了环信账号
     * 现在我们要查询用户环信账号的信息，返回到客户端；客户端会自动登录环信
     *
     * 请求路径：/huanxin/user
     * 请求方式：get
     * 响应数据：HuanXinUserVo
     */
    @GetMapping("/user")
    public ResponseEntity queryHuanXinInfo(){

        HuanXinUserVo huanXinUserVo = huanXinService.queryHuanXinInfo();
        return ResponseEntity.ok(huanXinUserVo);
    }
}
